package com.tanhua.dubbo.api.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.api.SoulQuestionOptionApi;
import com.tanhua.dubbo.mapper.SoulQuestionOptionMapper;
import com.tanhua.dubbo.pojo.SoulQuestionOption;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService(version = "1.0.0")
public class SoulQuestionOptionApiImpl implements SoulQuestionOptionApi {
    @Autowired
    private SoulQuestionOptionMapper soulQuestionOptionMapper;

    @Override
    public List<SoulQuestionOption> queryListById(Long questionId) {
        QueryWrapper<SoulQuestionOption> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("question_id", questionId);
        return this.soulQuestionOptionMapper.selectList(queryWrapper);
    }

    @Override
    public SoulQuestionOption queryOneById(Long id) {
        QueryWrapper<SoulQuestionOption> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id", id);
        return this.soulQuestionOptionMapper.selectOne(queryWrapper);
    }
}
